# -*- coding: utf-8 -*-
__author__ = 'lztkdr'
__date__ = '2020/11/27 13:20'

from types import MethodType


class Student(object):
	pass


stu = Student()
# 动态给实例绑定一个属性
stu.name = 'zhangsan'
print(stu.name)


def set_age(self, age):
	self.age = age


# 给实例绑定一个方法
stu.set_age = MethodType(set_age, stu)
stu.set_age(25)

print(stu.age)
